/*
 * http://stackoverflow.com/questions/4568645/printing-1-to-1000-without-loop-or-conditionals
 * Print numbers from 1 to 1000 without using any loop or conditional statements. Don't just write the printf() or cout statement 1000 times.
*/

#include <iostream>

/// method 1
// use g++ -ftemplate-depth-n flag.
template < int N >
class list_number
{
public:
	static void out( void )
	{
		list_number< N - 1 >::out();
		std::cout << N << std::endl;
	}
};

template <>
class list_number< 0 >
{
public:
	static void out( void )
	{
	}
};


/// method 2
class NumPrinter
{
	NumPrinter()
	{
		// TODO
	}
};

int main(int argc, char *argv[] )
{
	list_number< 1000 >::out();
	return 0;
}
